package com.simple.chiralium.common.core.annotion.operationLogger;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * 日志切面
 *
 * @author SimpleZzz
 * @date 2022/01/05 21:50:03
 */
@Aspect
@Slf4j
@Component
public class LoggerAspect {

    @Around("@annotation(operationLogger)")
    @SneakyThrows
    public Object around(ProceedingJoinPoint point, OperationLogger operationLogger) {
        String className = point.getTarget().getClass().getName();
        String methodName = point.getSignature().getName();
        log.info("[类名]：{},[方法名]:{}", className, methodName);

        return point.proceed();
    }
}
